﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>检查机器是否安装Word</title>
    <script type="text/javascript" language="JavaScript">
        function CheckWord()
        {
            try
            {new ActiveXObject("WScript.Shell");}   //创建新控件
            catch(x) {return false;}
            try
            {new ActiveXObject("Word.Application");}//创建word新应用程序
            catch(x){return null;}
            return true;
        }
        res=CheckWord();                         //检查是否安装了word
        switch(res)
        {
            case true:
                alert("安装了Word"); break;
            case null:
                alert("没有安装Word"); break;
            case false:
                alert("当前机器的ActiveX被禁用");
        }

    </script>
</head>
<body>

</body>
</html>